<?php if(count($beats)>0):?>
	<?php foreach ($beats as $beat):?>
	<?php if($beat->getKaraokeFilePath()!= null){
		$filePath = MEDIA_DOMAIN.'/ringtone/beat/'.$beat->getKaraokeFilePath();
	}
	?>	
	<div class="beat_name">
		<input type="radio" style="width: 30px;" name="convert_song[beat_id]" value="<?php echo $beat->getId();?>"><?php echo $beat->getBeatName();?>
		<input id="button_play_<?php echo $beat->getId();?>" type="button" value="Nghe thử" onclick="return showPlayer(<?php echo $beat->getId();?>);" style="width: 80px;"/>
	    <div id="player_<?php echo $beat->getId();?>" style="display:none">        
	        <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="328" height="200">
				<param name="movie" value="/flash/player-viral.swf" />
				<param name="allowfullscreen" value="true" />
				<param name="allowscriptaccess" value="always" />
				<param name="flashvars" value="file=<?php echo $filePath;?>&image=preview.jpg" />
				<object type="application/x-shockwave-flash" data="/flash/player-viral.swf" width="328" height="200">
					<param name="movie" value="/flash/player-viral.swf" />
					<param name="allowfullscreen" value="true" />
					<param name="allowscriptaccess" value="always" />
					<param name="flashvars" value="file=<?php echo $filePath;?>&image=preview.jpg" />
					<p><a href="http://get.adobe.com/flashplayer">Get Flash</a> to see this player.</p>
				</object>
			</object>

	    </div>
   </div>
	<?php endforeach;?>
<?php else:?>
Không có bản beat nào tương ứng
<?php endif;?>
<script type="text/javascript">
 function showPlayer(beatId){
	 if(document.getElementById('player_'+beatId).style.display == "none"){
		document.getElementById('player_'+beatId).style.display = "block";
	 	document.getElementById('button_play_'+beatId).value = "Đóng lại";
	 }else{
		 document.getElementById('player_'+beatId).style.display = "none";
		 document.getElementById('button_play_'+beatId).value = "Nghe thử";
	}
}
</script>